<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="head(title)">

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <title th:replace="${title}"></title>

    <!-- Bootstrap Core CSS -->
    <link th:href="@{/static/vendor/bootstrap/css/bootstrap.min.css}" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link th:href="@{/static/vendor/metisMenu/metisMenu.min.css}" rel="stylesheet">

    <!-- Custom CSS -->
    <link th:href="@{/static/dist/css/sb-admin-2.css}" rel="stylesheet">

    <!-- Custom Fonts -->
    <link th:href="@{/static/vendor/font-awesome/css/font-awesome.min.css}" rel="stylesheet" type="text/css">
    <link th:href="@{/static/vendor/morrisjs/morris.css}" rel="stylesheet">
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<body>
<nav th:fragment="nav" class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="index.html">疫情监测与上报系统</a>
    </div>
    <!-- /.navbar-header -->

    <ul class="nav navbar-top-links navbar-right">
        <!-- /.dropdown -->
        <li class="dropdown">姓名：<span th:text="${session.name}">111</span> &nbsp;</li>
        <li class="dropdown">角色：<span th:text="${session.role}">admin</span></li>
        <li class="dropdown" th:if="${session.role eq '学生'}">
            <a class="dropdown-toggle" href="#" data-toggle="modal" data-target="#my_message">
                <i class="fa fa-envelope fa-fw"></i><span class="badge" th:text="${session.message_count}">1</span></i>
            </a>
        </li>
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
            </a>
            <ul class="dropdown-menu dropdown-user">
                <li><a href="/to_password"><i class="fa fa-user fa-fw"></i> 修改密码</a>
                    <!--                </li>-->
                    <!--                <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>-->
                    <!--                </li>-->
                <li class="divider"></li>
                <li><a th:href="@{/logout}"><i class="fa fa-sign-out fa-fw"></i> 退出</a>
                </li>
            </ul>
            <!-- /.dropdown-user -->
        </li>
        <!-- /.dropdown -->
    </ul>
    <!-- /.navbar-top-links -->

    <div class="navbar-default sidebar" role="navigation">
        <div class="sidebar-nav navbar-collapse">
            <ul class="nav" id="side-menu">
                <li class="sidebar-search">
                    <div class="input-group custom-search-form">
                        <input type="text" class="form-control" placeholder="Search...">
                        <span class="input-group-btn">
                                    <button class="btn btn-default" type="button">
                                        <i class="fa fa-search"></i>
                                    </button>
                                </span>
                    </div>
                    <!-- /input-group -->
                </li>
                <li th:if="${session.role eq '管理员'}">
                    <a th:href="@{/admin/index}"><i class="fa fa-dashboard fa-fw"></i>仪表盘</a>
                </li>
                <li th:if="${session.role eq '管理员'}">
                    <a href="#"><i class="fa fa-user fa-fw"></i>学生管理<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a th:href="@{/student/list}">学生列表</a>
                        </li>
                        <li>
                            <a th:href="@{/student/to_add}">添加学生</a>
                        </li>
                    </ul>
                </li>
                <li th:if="${session.role eq '管理员'}">
                    <a href="#"><i class="fa fa-th-large fa-fw"></i>班级管理<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a th:href="@{/clbum/list}">班级列表</a>
                        </li>
                        <li>
                            <a th:href="@{/clbum/to_add}">添加班级</a>
                        </li>
                    </ul>
                </li>
                <li th:if="${session.role eq '管理员'}">
                    <a href="#"><i class="fa fa-bar-chart-o fa-fw"></i>教师管理<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li>
                            <a th:href="@{/teacher/list}">教师列表</a>
                        </li>
                        <li>
                            <a th:href="@{/teacher/to_add}">添加教师</a>
                        </li>
                    </ul>
                </li>
                <li th:if="${session.role eq '教师'}">
                    <a href="/teacher/index"><i class="fa fa-dashboard fa-fw"></i>仪表盘</a>
                </li>
                <li th:if="${session.role eq '教师'}">
                    <a href="#"><i class="fa fa-wrench fa-fw"></i> 已上报列表<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li th:each="clbum:${session.clbums}">
                            <a th:href="'/record/list/'+${clbum.id}" th:text="${clbum.name}">Panels and Wells</a>
                        </li>
                    </ul>
                    <!-- /.nav-second-level -->
                </li>
                <li th:if="${session.role eq '教师'}">
                    <a href="#"><i class="fa fa-sitemap fa-fw"></i> 未上报列表<span class="fa arrow"></span></a>
                    <ul class="nav nav-second-level">
                        <li th:each="clbum:${session.clbums}">
                            <a th:href="'/record/un_reported/'+${clbum.id}" th:text="${clbum.name}">Panels and Wells</a>
                        </li>
                    </ul>
                </li>
                <li th:if="${session.role eq '学生'}">
                    <a th:href="@{/student/index}"><i class="fa fa-dashboard fa-fw"></i>仪表盘</a>
                </li>
                <li th:if="${session.role eq '学生'}">
                    <a th:href="@{/record/to_add}"><i class="fa fa-exclamation fa-fw"></i> 健康天天报</a>
                </li>
                <li th:if="${session.role eq '学生'}">
                    <a th:href="@{/student_line}"><i class="fa fa-edit fa-fw"></i> 体温统计</a>
                </li>
                <li th:if="${session.role eq '学生'}">
                    <a th:href="@{/record/person_record}"><i class="fa fa-envelope fa-fw"></i> 上报记录</a>
                </li>
                <li th:if="${session.role eq '学生'}">
                    <a th:href="@{/message/list}"><i class="fa fa-comment-o fa-fw"></i> 消息记录</a>

                </li>
            </ul>
        </div>
        <!-- /.sidebar-collapse -->
    </div>
    <!-- /.navbar-static-side -->
</nav>
<div th:fragment="my_message" class="modal fade" id="my_message" tabindex="-1"
     role="dialog" aria-labelledby="my_message"
     aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">我的消息</h4>
            </div>
            <div class="modal-body">
                <div class="alert alert-warning alert-dismissable" th:each="message : ${session.messages}">
                    <button type="button" class="close readed" data-dismiss="alert" aria-hidden="true" th:data-id="${message.id}">
                        &times;
                    </button>
                    <div>
                        <strong th:text="${message.teacher.name}+'老师'">John Smith</strong>
                        <span class="pull-right text-muted"><em th:text="${#temporals.format(message.createTime,'yyyy-MM-dd HH:mm:ss')}">Yesterday</em></span>
                    </div>
                    <div th:text="${message.content}">Lorem ipsum dolor sit amet, consectetur adipiscing elit.
                        Pellentesque eleifend...
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<!--                <button type="button" class="btn btn-primary">Save changes</button>-->
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
    <script>
        window.onload=function() {
            $('.readed').click(function () {
                var id = $(this).data('id');
                $.get("/message/readed?id="+id,function (data) {
                    alert(data.msg);
                })
            })
        }
    </script>
</div>
<th:block th:fragment="js">
    <!-- jQuery -->
    <script th:src="@{/static/vendor/jquery/jquery.min.js}"></script>
    <!-- Bootstrap Core JavaScript -->
    <script th:src="@{/static/vendor/bootstrap/js/bootstrap.min.js}"></script>
    <!-- Metis Menu Plugin JavaScript -->
    <script th:src="@{/static/vendor/metisMenu/metisMenu.min.js}"></script>
    <!-- Custom Theme JavaScript -->
    <script th:src="@{/static/dist/js/sb-admin-2.js}"></script>

    <script th:src="@{/static/vendor/raphael/raphael.min.js}"></script>
    <script th:src="@{/static/vendor/morrisjs/morris.min.js}"></script>
</th:block>
</body>
</html>